package com.cooge.sharevideo.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooge.sharevideo.web.dao.EpisodeVideoDao;
import com.cooge.sharevideo.web.pojo.EpisodeVideo;
import com.cooge.sharevideo.web.service.EpisodeVideoService;
@Service
public class EpisodeVideoServiceImpl implements EpisodeVideoService {
	
	@Autowired
	EpisodeVideoDao episodeVideoDao;
	
	@Override
	public List<EpisodeVideo> getlistByVideoId(Long videoId) {
		
		EpisodeVideo episodeVideo  = new EpisodeVideo();
		episodeVideo.setVideoId(videoId);
		episodeVideo = episodeVideoDao.getList(episodeVideo).get(0);
		EpisodeVideo episodeVideo_  = new EpisodeVideo();
		episodeVideo_.setEpisodeId(episodeVideo.getEpisodeId());
		
		List<EpisodeVideo> list = episodeVideoDao.getList(episodeVideo_,"videoId");
		
		return list;
	}

	@Override
	public List<EpisodeVideo> getlistByEpisodeId(Long episodeId) {
		
		EpisodeVideo episodeVideo  = new EpisodeVideo();
		episodeVideo.setEpisodeId(episodeId);
		List<EpisodeVideo> list = episodeVideoDao.getList(episodeVideo);
		
		return list;
	}

	@Override
	public EpisodeVideo getByVideoId(Long videoId) {
		EpisodeVideo episodeVideo  = new EpisodeVideo();
		episodeVideo.setVideoId(videoId);
		episodeVideo = episodeVideoDao.getList(episodeVideo).get(0);
		return episodeVideo;
	}

}
